﻿<?xml version="1.0" encoding="utf-8" ?>

<sqlMap namespace="WorkflowProcess" xmlns="http://ibatis.apache.org/mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
  
  <resultMaps>
    <resultMap id="SelectResult" class="XMLWorkflow">
      <result property="ProcessId" column="PROCESS_ID" />
      <result property="Name" column="Name" />
      <result property="Status" column="Status" />
      <result property="Description" column="Description" />
      <result property="ParentProcess" column="ParentProcess" />
    </resultMap>
  </resultMaps>

  <statements>

    <select id="SelectAllWorkflow" resultMap="SelectResult">
      select * from sf_workflowprocesses;
    </select>

    <select id="dynamicGetWorkflowList" parameterClass="XMLWorkflow" resultMap="SelectResult" >
      select * from sf_workflowprocesses
      <dynamic prepend="WHERE">
        <isGreaterThan prepend="AND"
             property="ProcessId"
             compareValue="0">
          ( PROCESS_ID = #ProcessId# )
        </isGreaterThan>
        <isNotNull prepend="AND" property="Status">
          Status=#Status#
        </isNotNull>
      </dynamic>
    </select>
  </statements>

</sqlMap>
